package lambda;

import java.util.function.Consumer;

public class ConsumerDemo {

    public static void main(String[] args) {
       //operatorString("asdf" , s -> System.out.println(s));
        operatorString("asdf", s -> {
            System.out.println( new StringBuilder(s).reverse().toString());
        });
    }

    //定义一个方法消费一个字符串
    private static void operatorString(String s, Consumer<String> consumer) {
        consumer.accept(s);
    }
}
